home *** CD-ROM | disk | FTP | other *** search
/ PC-X 1997 October / pcx14_9710.iso / swag / delphi.swg / 0240_Convert your colors to hex strings.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-05-30  |  521 b   |  19 lines

  1.  
  2.  
  3. --------------------------------------------------------------------------------
  4. In Delphi, color is often represented using the TColor object. In HTML
  5. documents, color is usually represented using a 6 character hex string.
  6. Following function will convert TColor type color values to hex strings:
  7.  
  8. function
  9.   GetColorHexStr( Color : TColor )
  10.     : string;
  11. begin
  12.   Result :=
  13.     IntToHex( GetRValue( Color ), 2 ) +
  14.     IntToHex( GetGValue( Color ), 2 ) +
  15.     IntToHex( GetBValue( Color ), 2 );
  16. end;
  17.  
  18.  
  19.